<?php 
	$urls = get_bloginfo('home')."/wp-admin/admin.php?page=tour-setting&action=tour-destination";
	include TEMPLATEPATH.'/orders/tour/views/process-destination.php';	
?>
<script type="text/javascript">
$(document).ready(function(){
	$(".destination_update_from").click(function(){
		var rel = $(this).attr("rel");
		rel = rel.split("-");
		
		$("#des_from_update_ID").val(rel[0]);
		$("#des_from_insert").val(rel[1]);

		$('.des_from_submit').removeClass('des_from_submit').addClass('des_from_submit_hidden');
		$('.des_from_update').removeClass('des_from_update').addClass('des_from_update_show');
		$('.des_from_return').removeClass('des_from_return').addClass('des_from_return_show');
	});
	/**********************/
	$(".destination_update_to").click(function(){
		var rel = $(this).attr("rel");
		rel = rel.split("-");
		
		$("#des_to_update_ID").val(rel[0]);
		$("#des_to_insert").val(rel[1]);

		$('.des_to_submit').removeClass('des_to_submit').addClass('des_to_submit_hidden');
		$('.des_to_update').removeClass('des_to_update').addClass('des_to_update_show');
		$('.des_to_return').removeClass('des_to_return').addClass('des_to_return_show');
	});
});
</script>
<style>
.des_to_submit_hidden,.des_to_update,.des_to_return
{
	display:none;
}
.des_to_return_show
{
	display:block;
}
.des_to_update_show
{
	display:block;
}
</style>
<div id="index_page">
	<p style="color: red;"><?php echo $error;?></p>
	<ul style="list-style: none outside none;">		
			<li style="float: left; width: 48%;">
				<form action="" method="post">
				<table style="width: 100%;">
					<tr>
						<td><h3>Destination From</h3></td>
					</tr>
					<tr>
						<td style="text-align: left; width: 40%;">
							<input size="30" type="text" id="des_from_insert" name="des_from_insert" value=""/>
							
							<input size="30" type="hidden" id="des_from_hidden_code" name="des_from_hidden_code" value="<?php echo $hidden_code;?>"/>
							<input size="30" type="hidden" id="des_from_update_ID" name="des_from_update_ID" value=""/>
						</td>
						<td>
							<input type="submit" class="des_from_submit" id="des_from_submit" name="des_from_submit" value="Insert"/>
							<input type="submit" class="des_from_update" id="des_from_update" name="des_from_update" value="Update"/>							
						</td>
						<td>
							<input type="submit" class="des_from_return" id="des_from_return" name="des_from_return" value="Return"/>
						</td>
					</tr>					
				</table>
				<?php
				$from_list = db_select_all_data_order("destination_from"); 
				?>
				<table>
					<tr>
						<td><b>ID</b></td>
						<td><b>Destination From</b></td>
						<td><b>Action</b></td>
					</tr>
					<?php
					if($from_list)
					{
						foreach ($from_list as $value) 
						{
						?>
						<tr>
							<td><?php echo $value->ID;?></td>
							<td><?php echo $value->destinationFrom;?></td>
							<td>
							<?php $str = $value->ID.'-'.$value->destinationFrom;?>
								<a class="destination_update_from" rel="<?php echo $str;?>" href="#">Update</a>&nbsp;|&nbsp;
								<a class="destination_update_from" href="<?php echo $urls;?>&des=from&del=<?php echo $value->ID;?>">Delete</a>
							</td>
						</tr>
						<?php 
						}
					} 
					?>
				</table>
				</form>
			</li>
			<!-- 
			<li style="float: left; width: 48%;">
				<form action="" method="post">			
				<table style="width: 100%;">
					<tr>
						<td><h3>Destination To</h3></td>
					</tr>
					<tr>
						<td style="text-align: left; width: 40%;">
							<input size="30" type="text" id="des_to_insert" name="des_to_insert" value=""/>
							
							<input size="30" type="hidden" id="des_to_hidden_code" name="des_to_hidden_code" value="<?php echo $hidden_code;?>"/>
							<input size="30" type="hidden" id="des_to_update_ID" name="des_to_update_ID" value=""/>
						</td>
						<td>
							<input type="submit" class="des_to_submit" id="des_to_submit" name="des_to_submit" value="Insert"/>
							<input type="submit" class="des_to_update" id="des_to_update" name="des_to_update" value="Update"/>							
						</td>
						<td>
							<input type="submit" class="des_to_return" id="des_to_return" name="des_to_return" value="Return"/>
						</td>
					</tr>					
				</table>
				<?php
				$from_list = db_select_all_data_order("destination_to"); 
				?>
				<table>
					<tr>
						<td><b>ID</b></td>
						<td><b>Destination To</b></td>
						<td><b>Action</b></td>
					</tr>
					<?php
					if($from_list)
					{
						foreach ($from_list as $value) 
						{
						?>
						<tr>
							<td><?php echo $value->ID;?></td>
							<td><?php echo $value->destinationTo;?></td>
							<td>
							<?php $str = $value->ID.'-'.$value->destinationTo;?>
								<a class="destination_update_to" rel="<?php echo $str;?>" href="#">Update</a>&nbsp;|&nbsp;
								<a class="destination_update_to" href="<?php echo $urls;?>&des=to&del=<?php echo $value->ID;?>">Delete</a>
							</td>
						</tr>
						<?php 
						}
					} 
					?>
				</table>
				</form>
			</li>	
			 -->	
	</ul>
</div>	